from google.appengine.ext import db as datastore


class HIT(datastore.Model):
  owner = datastore.UserProperty()
  added = datastore.DateTimeProperty(auto_now_add=True)
  title = datastore.StringProperty()
  description = datastore.TextProperty()
  location = datastore.StringProperty()
  location1 = datastore.StringProperty()
  size1 = datastore.IntegerProperty()
  location2 = datastore.StringProperty()
  size2 = datastore.IntegerProperty()
  location3 = datastore.StringProperty()
  size3 = datastore.IntegerProperty()
  location4 = datastore.StringProperty()
  size4 = datastore.IntegerProperty()
  location5 = datastore.StringProperty()
  size5 = datastore.IntegerProperty()
  location6 = datastore.StringProperty()
  size6 = datastore.IntegerProperty()
  location7 = datastore.StringProperty()
  size7 = datastore.IntegerProperty()
  location8 = datastore.StringProperty()
  size8 = datastore.IntegerProperty()
  location9 = datastore.StringProperty()
  size9 = datastore.IntegerProperty()
  location10 = datastore.StringProperty()
  size10 = datastore.IntegerProperty()
  lifetime = datastore.IntegerProperty()
  duration = datastore.IntegerProperty()
  approval_delay = datastore.IntegerProperty()
  frame_height = datastore.IntegerProperty()
  max_workers = datastore.IntegerProperty()
  min_workers = datastore.IntegerProperty()
  reward = datastore.StringProperty()
  aws_access_key = datastore.StringProperty()
  aws_secret_key = datastore.StringProperty()
  handle_submit = datastore.BooleanProperty()
  always_pay = datastore.BooleanProperty()
  sandbox = datastore.BooleanProperty()
  next_worker_number = datastore.IntegerProperty()
  blacklist = datastore.StringListProperty()
  mturkid = datastore.StringProperty()
  groupid = datastore.StringProperty()
  time = datastore.DateTimeProperty()
  auth_secret = datastore.StringProperty()
  info = datastore.TextProperty()
  focal_time = datastore.DateTimeProperty()
  type = datastore.StringProperty(default='NORMAL',
           choices=set(['NORMAL', 'MULTIPLE_URLS', 'FOCAL_TIME', 'PASS_THROUGH']))


class Worker(datastore.Model):
  hit = datastore.ReferenceProperty(HIT)
  last_seen = datastore.DateTimeProperty(auto_now_add=True, auto_now=True)
  mturkid = datastore.StringProperty()
  assignment_id = datastore.StringProperty()
  number = datastore.IntegerProperty()
  remote_addr = datastore.StringProperty()
  user_agent = datastore.StringProperty()
  click_go = datastore.BooleanProperty(default=False)  # clicked Go button?
